﻿
Partial Class WebForm_ManageFinanceYTDReport_SearchOption
    Inherits System.Web.UI.UserControl

    Protected BaseYear As Integer = 2010


    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            pnlSelect.DataBind()
        End If
    End Sub

    Protected Sub ddlSignature_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
        ddlChannel.DataBind()
        ddlHier1.DataBind()
    End Sub

    Protected Sub ddlChannel_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
        ddlHier1.DataBind()
    End Sub

    Public ReadOnly Property Division() As String
        Get
            Return Request("Division")
        End Get
    End Property

    Public ReadOnly Property Signature() As String
        Get
            Return ddlSignature.Text
        End Get
    End Property

    Public ReadOnly Property SigList() As List(Of String)
        Get
            Dim result As New List(Of String)

            If Signature <> String.Empty Then
                result.Add(Signature)
            Else
                For Each item As ListItem In ddlSignature.Items
                    result.Add(item.Value)
                Next
            End If

            Return result
        End Get
    End Property

    Public ReadOnly Property ChList() As List(Of String)
        Get
            Dim result As New List(Of String)

            If Channel <> MyObj.GetDDLSelectAllItemV2.Text Then
                result.Add(Channel)
            Else
                For Each item As ListItem In ddlChannel.Items
                    result.Add(item.Value)
                Next
            End If

            Return result
        End Get
    End Property

    Public ReadOnly Property Hier1List() As List(Of String)
        Get
            Dim result As New List(Of String)

            If Hier1 <> MyObj.GetDDLSelectAllItemV2.Text Then
                result.Add(Hier1)
            Else
                For Each item As ListItem In ddlHier1.Items
                    result.Add(item.Value)
                Next
            End If

            Return result
        End Get
    End Property

    Public ReadOnly Property Channel() As String
        Get
            Return ddlChannel.Text
        End Get
    End Property

    Public ReadOnly Property Hier1() As String
        Get
            Return ddlHier1.Text
        End Get
    End Property

    Public ReadOnly Property StartMonth() As Integer
        Get
            Return 1
        End Get
    End Property

    Public ReadOnly Property EndMonth() As Integer
        Get
            Return ddlMonth.Text
        End Get
    End Property

    Public ReadOnly Property Year() As Integer
        Get
            Return ddlYear.Text
        End Get
    End Property

    Public ReadOnly Property SignatureText() As String
        Get
            Return ddlSignature.SelectedItem.Text
        End Get
    End Property

    Public ReadOnly Property ChannelText() As String
        Get
            Return ddlChannel.SelectedItem.Text
        End Get
    End Property

    Public ReadOnly Property Hier1Text() As String
        Get
            Return ddlHier1.SelectedItem.Text
        End Get
    End Property

    Public Event Submit(ByVal sender As Object, ByVal e As EventArgs)

    Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
        RaiseEvent Submit(Me, EventArgs.Empty)
    End Sub

    Public Event Export(ByVal sender As Object, ByVal e As EventArgs)

    Protected Sub btnExportGroupByCG_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnExportGroupByCG.Click
        RaiseEvent Export(Me, EventArgs.Empty)
    End Sub
End Class
